﻿Public Class frmTabBasicInfo

    Public Shared objCitation As CiteInfo = New CiteInfo()
    Public Shared objCitationLWork As CiteInfo = New CiteInfo()
    Public Shared bCitationLWork As Boolean
    Public Shared intTimeStyle As Integer
    Public Shared IDtimeper As Collection = New Collection()
    Dim editNode As EditXML = New EditXML()

    Private Sub btnIDCite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIDCite.Click
        Dim s1 As String = ""
        'invokes the Citation details form
        Dim frmCiteDetails As New frmCiteInfo(objCitation, objCitationLWork, bCitationLWork, intTimeStyle)
        frmCiteDetails.ShowDialog()
        If (frmCiteDetails.getUpdated() = True) Then
            objCitation = frmCiteDetails.getNewCite()
            s1 = objCitation.Author
            objCitation.Author = fixStringCrLf(s1)
            bCitationLWork = frmCiteDetails.getLWC()
            If (bCitationLWork = True) Then
                objCitationLWork = frmCiteDetails.getNewLWC()
                s1 = objCitationLWork.Author
                objCitationLWork.Author = fixStringCrLf(s1)
            End If
            editXMLFile()
        End If
        txtIDCiteAuth.Text = objCitation.Author
        txtIDCiteDate.Text = objCitation.PubDate
        txtIDCiteTitle.Text = objCitation.Title
    End Sub

    Private Function fixStringCrLf(ByVal strInput As String) As String
        'routine to remove extraneous CR/LF from string
        ' result is string containing non-empty substrings separated by single CR/LF
        Dim strValues() As String
        Dim intLen As Integer = 0
        Dim intPos As Integer = 0
        Dim bAdd As Boolean = False
        Dim strSingle As String = "" '= CrLf

        If (Len(strInput) = 0) Then 'if blank, return blank string
            Return strInput
        End If

        strValues = Split(strInput, strSingle)  'split using CR/LF as delimiter
        intLen = strValues.GetLength(0)         'get number of substrings found

        strInput = ""                           're-initialize string being parsed
        bAdd = False
        For intPos = 0 To intLen - 1            'add non-zero length substrings, separate with CR/LF
            If (strValues(intPos) <> "") Then
                If (bAdd = True) Then
                    'strInput = strInput & CrLf & strValues(intPos)
                Else
                    'first non-blank entry is not preceded by CrLf
                    strInput = strValues(intPos)
                    bAdd = True
                End If
            End If
        Next

        Return strInput
    End Function

    Private Sub btnTimeAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimeAdd.Click
        Dim iCount As Integer = IDtimeper.Count
        Dim strNewDate As String = ""
        Dim sError As String = ""
        If (rdoTLocal.Checked = True) Then  'process Gregorian dates
            If (rdoTUnknown.Checked = True) Then
                sError = "Please specify Single, Multiple, or Range of Dates"
                MessageBox.Show(sError, "Date/Time error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Return
            End If
            If (rdoTSingle.Checked = True And iCount = 1) Then
                sError = "Can't add another date to single date/time"
                MessageBox.Show(sError, "Add date error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Return
            End If
            If (rdoTRange.Checked = False) Then  'add and update 1 date/time
                Dim dSingle As New SngDateTime
                Dim frmTDate As New frmTimePeriod(intTimeStyle, dSingle)
                frmTDate.ShowDialog()
                If (frmTDate.getChanged() = False) Then
                Else
                    dSingle = frmTDate.getBegDate()
                    IDtimeper.Add(dSingle)
                    strNewDate = dSingle.SngDate & "  " & dSingle.TimeOfDay
                    lboxTime.Items.Add(strNewDate)
                End If
            Else
                If (rdoTRange.Checked = True And iCount > 1) Then
                    MessageBox.Show("Can only have 1 date range.", "Add date range error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    Return
                End If
                Dim dBegin As New SngDateTime     'add and update date/time range
                Dim dEnding As New SngDateTime
                Dim frmTDate As New frmTimePeriod(intTimeStyle, dBegin, dEnding)
                frmTDate.ShowDialog()
                If (frmTDate.getChanged() = False) Then
                Else
                    dBegin = frmTDate.getBegDate()
                    dEnding = frmTDate.getEndDate()
                    IDtimeper.Add(dBegin)
                    IDtimeper.Add(dEnding)
                    strNewDate = "begin: " & dBegin.SngDate & "  " & "end: " & dEnding.SngDate
                    lboxTime.Items.Add(strNewDate)
                End If
            End If
        Else                              'process Geologic Age dates
            If (rdoTUnknown.Checked = True) Then
                sError = "Please specify Single, Multiple, or Range of Dates"
                MessageBox.Show(sError, "Date/Time error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Return
            End If
            If (rdoTSingle.Checked = True And iCount = 1) Then
                MessageBox.Show("Can't add another Age to single Geologic Age", "Add Geologic Age", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Return
            End If
            If (rdoTRange.Checked = False) Then  'add and update 1 Geologic Age
                Dim dSingle As New GeolAge
                Dim frmTDate As New frmGeolAge(dSingle)
                frmTDate.ShowDialog()
                If (frmTDate.getChanged() = False) Then
                Else
                    dSingle = frmTDate.getBegGeol()
                    IDtimeper.Add(dSingle)
                    strNewDate = dSingle.TimeScale & "  " & dSingle.Estim
                    lboxTime.Items.Add(strNewDate)
                End If
            Else
                If (rdoTRange.Checked = True And iCount > 1) Then
                    MessageBox.Show("Can only have 1 Geologic Age range.", "Add Geologic Age range error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    Return
                End If
                Dim dBegin As New GeolAge     'add and update Geologic Age range
                Dim dEnding As New GeolAge
                Dim frmTDate As New frmGeolAge(dBegin, dEnding)
                frmTDate.ShowDialog()
                If (frmTDate.getChanged() = False) Then
                Else
                    dBegin = frmTDate.getBegGeol()
                    dEnding = frmTDate.getEndGeol()
                    IDtimeper.Add(dBegin)
                    IDtimeper.Add(dEnding)
                    strNewDate = "begin: " & dBegin.Estim & "  " & "end: " & dEnding.Estim
                    lboxTime.Items.Add(strNewDate)
                End If
            End If
        End If

        validateTime()
    End Sub

    Private Sub btnTimeEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimeEdit.Click
        Dim iCount As Integer = IDtimeper.Count
        Dim iToEdit1 As Integer = 0
        Dim iToEdit2 As Integer = 0
        Dim iToRemove As Integer = 0
        Dim strNewDate As String = ""
        Dim strError As String = ""

        btnTimeEdit.Enabled = False
        btnTimeDelete.Enabled = False
        validateTime()

        If (iCount = 0) Then 'Edit button pressed by mistake -- no entries to edit
            strError = "There are no Time Period entries to edit."
            MessageBox.Show(strError, "Selection error", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Return
        End If
        If (rdoTLocal.Checked = True) Then  'Gregorian dates section
            If (rdoTSingle.Checked = True) Then 'Edits a single date
                Dim dSingle As New SngDateTime
                dsingle = CType(IDtimeper(1), SngDateTime)
                Dim frmTDate1 As New frmTimePeriod(intTimeStyle, dSingle)
                frmTDate1.ShowDialog()
                If (frmTDate1.getChanged() = False) Then 'update was cancelled
                Else
                    dSingle = frmTDate1.getBegDate()          'get updated single date/time
                    IDtimeper.Remove(1)                  'clear existing single date/time
                    lboxTime.Items.Clear()
                    IDtimeper.Add(dSingle)               'add updated single date/time to collection and form
                    strNewDate = dSingle.SngDate & "  " & dSingle.TimeOfDay
                    lboxTime.Items.Add(strNewDate)
                End If
                Return
            End If
            If (rdoTMult.Checked = True) Then  'Edits member of multiple date/time collection
                Dim dSingle As New SngDateTime
                iToEdit1 = lboxTime.SelectedIndex 'zero-based index
                If (iToEdit1 = -1) Then
                    strError = "One of the Time Period entries must be selected for editing."
                    MessageBox.Show(strError, "Date editing selection error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    Return
                End If
                dsingle = CType(IDtimeper(iToEdit1 + 1), SngDateTime) 'collection is one-based index
                Dim frmTDate2 As New frmTimePeriod(intTimeStyle, dSingle)
                frmTDate2.ShowDialog()
                If (frmTDate2.getChanged() = False) Then 'update was cancelled
                Else
                    dSingle = frmTDate2.getBegDate()             'get updated date/time entry
                    IDtimeper.Add(dSingle, , iToEdit1 + 1)  'add to collection before original version of entry
                    IDtimeper.Remove(iToEdit1 + 2)          'remove old version of entry from collection
                    strNewDate = dSingle.SngDate & "  " & dSingle.TimeOfDay
                    lboxTime.Items.Insert(iToEdit1, strNewDate)  'insert edited entry into listbox
                    lboxTime.Items.RemoveAt(iToEdit1 + 1)        'remove old version from listbox
                End If
                Return
            End If
            If (rdoTRange.Checked = True) Then     'Edits a date/time range
                Dim dBegin As New SngDateTime
                Dim dEnding As New SngDateTime
                dBegin = CType(IDtimeper(1), SngDateTime)
                dEnding = CType(IDtimeper(2), SngDateTime)
                Dim frmTDate As New frmTimePeriod(intTimeStyle, dBegin, dEnding)
                frmTDate.ShowDialog()
                If (frmTDate.getChanged() = False) Then 'update was cancelled
                Else
                    dBegin = frmTDate.getBegDate()            'get updated date/time range
                    dEnding = frmTDate.getEndDate()
                    IDtimeper.Remove(2)                  'remove old range entries from collection and listbox
                    IDtimeper.Remove(1)
                    lboxTime.Items.Clear()
                    IDtimeper.Add(dBegin)                 'add new range entries to collection and listbox
                    IDtimeper.Add(dEnding)
                    strNewDate = "begin: " & dBegin.SngDate & "  " & "end: " & dEnding.SngDate
                    lboxTime.Items.Add(strNewDate)
                End If
                Return
            End If
        Else        'process Geologic Ages
            If (rdoTSingle.Checked = True) Then 'Edits a single Geologic Age
                Dim dSingle As New GeolAge
                dSingle = CType(IDtimeper(1), GeolAge)
                Dim frmTGeol1 As New frmGeolAge(dsingle)
                frmTGeol1.ShowDialog()
                If (frmTGeol1.getChanged() = False) Then 'update was cancelled
                Else
                    dSingle = frmTGeol1.getBegGeol()          'get updated single date/time
                    IDtimeper.Remove(1)                  'clear existing single date/time
                    lboxTime.Items.Clear()
                    IDtimeper.Add(dSingle)               'add updated single date/time to collection and form
                    strNewDate = dSingle.TimeScale & "  " & dSingle.Estim
                    lboxTime.Items.Add(strNewDate)
                End If
                Return
            End If
            If (rdoTMult.Checked = True) Then  'Edits member of multiple Geologic Age collection
                Dim dSingle As New GeolAge
                iToEdit1 = lboxTime.SelectedIndex 'zero-based index
                If (iToEdit1 = -1) Then
                    strError = "One of the Time Period entries must be selected for editing."
                    MessageBox.Show(strError, "Date editing selection error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    Return
                End If
                dSingle = CType(IDtimeper(iToEdit1 + 1), GeolAge) 'collection is one-based index
                Dim frmTGeol2 As New frmGeolAge(dSingle)
                frmTGeol2.ShowDialog()
                If (frmTGeol2.getChanged() = False) Then 'update was cancelled
                Else
                    dSingle = frmTGeol2.getBegGeol()             'get updated date/time entry
                    IDtimeper.Add(dSingle, , iToEdit1 + 1)  'add to collection before original version of entry
                    IDtimeper.Remove(iToEdit1 + 2)          'remove old version of entry from collection
                    strNewDate = dSingle.TimeScale & "  " & dSingle.Estim
                    lboxTime.Items.Insert(iToEdit1, strNewDate)  'insert edited entry into listbox
                    lboxTime.Items.RemoveAt(iToEdit1 + 1)        'remove old version from listbox
                End If
                Return
            End If
            If (rdoTRange.Checked = True) Then     'Edits a Geologic Age range
                Dim dBegin As New GeolAge
                Dim dEnding As New GeolAge
                dBegin = CType(IDtimeper(1), GeolAge)
                dEnding = CType(IDtimeper(2), GeolAge)
                Dim frmTGeol As New frmGeolAge(dBegin, dEnding)
                frmTGeol.ShowDialog()
                If (frmTGeol.getChanged() = False) Then 'update was cancelled
                Else
                    dBegin = frmTGeol.getBegGeol()            'get updated date/time range
                    dEnding = frmTGeol.getEndGeol()
                    IDtimeper.Remove(2)                  'remove old range entries from collection and listbox
                    IDtimeper.Remove(1)
                    lboxTime.Items.Clear()
                    IDtimeper.Add(dBegin)                 'add new range entries to collection and listbox
                    IDtimeper.Add(dEnding)
                    strNewDate = "begin: " & dBegin.Estim & "  " & "end: " & dEnding.Estim
                    lboxTime.Items.Add(strNewDate)
                End If
                Return
            End If
        End If
    End Sub

    Private Sub btnTimeDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimeDelete.Click
        Dim iCount As Integer = IDtimeper.Count
        Dim iToRemove As Integer = 0
        btnTimeEdit.Enabled = False
        btnTimeDelete.Enabled = False

        If (iCount = 0) Then 'Delete button pressed by mistake -- no entries to delete
            MessageBox.Show("There are no time period entries to delete", "Selection error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            validateTime()
            Return
        End If
        If (rdoTSingle.Checked = True) Then 'Deletes a single date
            IDtimeper.Remove(1)
            lboxTime.Items.Clear()
            validateTime()
            Return
        End If
        If (rdoTRange.Checked = True) Then 'Deletes a range
            IDtimeper.Remove(2)
            IDtimeper.Remove(1)
            lboxTime.Items.Clear()
            validateTime()
            Return
        End If
        iToRemove = lboxTime.SelectedIndex 'zero-based index
        If (iToRemove = -1) Then
            Dim sDelError As String = "No time period selected for deletion"
            MessageBox.Show(sDelError, "Selection error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            validateTime()
            Return
        End If
        IDtimeper.Remove(iToRemove + 1)
        lboxTime.Items.RemoveAt(iToRemove)
        validateTime()
    End Sub

    Private Sub lboxTime_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lboxTime.SelectedIndexChanged
        If lboxTime.SelectedItems.Count() > 0 Then
            btnTimeEdit.Enabled = True
            btnTimeDelete.Enabled = True
        End If
    End Sub

    Private Sub rdoTSingle_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoTSingle.Click
        Dim iCount As Integer = IDtimeper.Count
        Dim iLoop As Integer = 0
        Dim dSingle As New SngDateTime
        Dim gSingle As New GeolAge
        Dim strNewDate As String = ""

        If (rdoTLocal.Checked = True) Then  'process Gregorian date/time
            If (rdoTSingle.Checked = True And iCount > 1) Then 'bring collection & list into conformance with being Single
                dSingle = CType(IDtimeper(1), SngDateTime)
                strNewDate = dSingle.SngDate & "  " & dSingle.TimeOfDay
                IDtimeper = New Collection
                IDtimeper.Add(dSingle)
                lboxTime.Items.Clear()
                lboxTime.Items.Add(strNewDate)
            End If
        Else                               'process Geologic Age
            If (rdoTSingle.Checked = True And iCount > 1) Then 'bring collection & list into conformance with being Single
                gSingle = CType(IDtimeper(1), GeolAge)
                strNewDate = gSingle.TimeScale & "  " & gSingle.Estim
                IDtimeper = New Collection
                IDtimeper.Add(gSingle)
                lboxTime.Items.Clear()
                lboxTime.Items.Add(strNewDate)
            End If
        End If
        validateTime()
    End Sub

    Private Sub rdoTMult_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoTMult.Click
        Dim iCount As Integer = IDtimeper.Count
        Dim iLoop As Integer = 0
        Dim strNewDate As String = ""
        Dim strNewDate2 As String = ""

        If (rdoTLocal.Checked = True) Then  'process Gregorian date/time
            If (rdoTMult.Checked = True And iCount = 2) Then
                Dim dBegin As New SngDateTime
                Dim dEnding As New SngDateTime
                dBegin = CType(IDtimeper(1), SngDateTime)
                dEnding = CType(IDtimeper(iCount), SngDateTime)
                strNewDate = dBegin.SngDate & "  " & dBegin.TimeOfDay
                strNewDate2 = dEnding.SngDate & "  " & dEnding.TimeOfDay
                lboxTime.Items.Clear()
                lboxTime.Items.Add(strNewDate)
                lboxTime.Items.Add(strNewDate2)
            End If
        Else                               'process Geologic Age
            If (rdoTMult.Checked = True And iCount = 2) Then
                Dim dBegin As New GeolAge
                Dim dEnding As New GeolAge
                dBegin = CType(IDtimeper(1), GeolAge)
                dEnding = CType(IDtimeper(iCount), GeolAge)
                strNewDate = dBegin.TimeScale & "  " & dBegin.Estim
                strNewDate2 = dEnding.TimeScale & "  " & dEnding.Estim
                lboxTime.Items.Clear()
                lboxTime.Items.Add(strNewDate)
                lboxTime.Items.Add(strNewDate2)
            End If
        End If
        validateTime()
    End Sub

    Private Sub rdoTRange_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoTRange.Click
        Dim iCount As Integer = IDtimeper.Count
        Dim iLoop As Integer = 0
        Dim strNewDate As String = ""

        If (rdoTLocal.Checked = True) Then   'process Gregorian date/time
            If (rdoTRange.Checked = True And iCount > 0) Then
                Dim dBegin As New SngDateTime
                Dim dEnding As New SngDateTime
                dBegin = CType(IDtimeper(1), SngDateTime)
                dEnding = CType(IDtimeper(iCount), SngDateTime)
                strNewDate = "begin: " & dBegin.SngDate & "  " & "end: " & dEnding.SngDate
                IDtimeper = New Collection
                IDtimeper.Add(dBegin)
                IDtimeper.Add(dEnding)
                lboxTime.Items.Clear()
                lboxTime.Items.Add(strNewDate)
            End If
        Else                                  'process Geologic Age
            If (rdoTRange.Checked = True And iCount > 0) Then
                Dim dBegin As New GeolAge
                Dim dEnding As New GeolAge
                dBegin = CType(IDtimeper(1), GeolAge)
                dEnding = CType(IDtimeper(iCount), GeolAge)
                strNewDate = "begin: " & dBegin.Estim & "  " & "end: " & dEnding.Estim
                IDtimeper = New Collection
                IDtimeper.Add(dBegin)
                IDtimeper.Add(dEnding)
                lboxTime.Items.Clear()
                lboxTime.Items.Add(strNewDate)
            End If
        End If
        validateTime()
    End Sub

    Private Sub rdoTUnknown_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoTUnknown.Click
        'initialize the controls
        lboxTime.Items.Clear()
        IDtimeper = New Collection
        validateTime()
    End Sub

    Private Sub rdoTLocal_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoTLocal.Click
        Dim iCount As Integer = IDtimeper.Count
        Dim objTest1 As New SngDateTime
        Dim objTest2 As New GeolAge

        If (iCount = 0) Then  'if no objects in collection, then no update necessary
            Return
        End If

        If (IDtimeper(1).GetType Is objTest1.GetType) Then 'click selects Gregorian; already in that type 
            Return
        ElseIf (IDtimeper(1).GetType Is objTest2.GetType) Then 'click selects Gregorian; remove Geologic collection
            IDtimeper = New Collection
            lboxTime.Items.Clear()
            Return
        Else
            MessageBox.Show("Unexpected object type. Contact program author", "Check multi-click on Gregorian date", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Return
        End If
    End Sub

    Private Sub rdoTGeol_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoTGeol.Click
        Dim iCount As Integer = IDtimeper.Count
        Dim objTest1 As New GeolAge
        Dim objTest2 As New SngDateTime

        If (iCount = 0) Then  'if no objects in collection, then no update necessary
            Return
        End If

        If (IDtimeper(1).GetType Is objTest1.GetType) Then 'click selects Geologic; already in that type 
            Return
        ElseIf (IDtimeper(1).GetType Is objTest2.GetType) Then 'click selects Geologic; remove Gregorian collection
            IDtimeper = New Collection
            lboxTime.Items.Clear()
            Return
        Else
            MessageBox.Show("Unexpected object type. Contact program author", "Check multi-click on Gregorian date", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Return
        End If
    End Sub

    Private Sub validateTime()
        If (rdoTSingle.Checked Or rdoTRange.Checked) And lboxTime.Items.Count >= 1 Then btnTimeAdd.Enabled = False Else btnTimeAdd.Enabled = True
        If rdoTUnknown.Checked Then btnTimeAdd.Enabled = False
    End Sub

    Private Sub txtAbstract_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAbstract.Leave
        editXMLFile()
    End Sub

    Private Sub txtPurpose_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPurpose.Leave
        editXMLFile()
    End Sub

    Private Sub txtSupplInfo_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSupplInfo.Leave
        editXMLFile()
    End Sub

    Public Sub editXMLFile()
        editNode.Remove("/metadata/idinfo", "citation")
        editNode.Add("/metadata/idinfo", "citation", "citation", editNode.createCiteInfo(objCitation, bCitationLWork, objCitationLWork))
        editNode.Edit("/metadata/idinfo/descript/abstract", txtAbstract.Text.Trim())
        editNode.Edit("/metadata/idinfo/descript/purpose", txtPurpose.Text.Trim())
        editNode.Edit("/metadata/idinfo/descript/supplinf", txtSupplInfo.Text.Trim())
        editNode.Remove("/metadata/idinfo", "timeperd")
        Dim newNode As String = ""
        Dim boolSingle As Boolean = False
        Dim boolRange As Boolean = False
        If rdoTSingle.Checked Then
            boolSingle = True
            boolRange = False
        ElseIf rdoTRange.Checked Then
            boolRange = True
            boolSingle = False
        ElseIf rdoTMult.Checked Then
            boolRange = True
            boolSingle = True
        End If
        If rdoTUnknown.Checked = False Then
            If rdoTLocal.Checked Then
                newNode = editNode.createTimeInfo(IDtimeper, boolSingle, boolRange)
            ElseIf rdoTGeol.Checked Then
                newNode = editNode.createGeoTimeInfo(IDtimeper, boolSingle, boolRange)
            End If
        End If
        newNode = newNode & "<current>" & cboxCurRef.SelectedItem & "</current>"
        editNode.Add("/metadata/idinfo", "/descript", "timeperd", newNode)
        editNode.Edit("/metadata/idinfo/status/progress", lboxProg.SelectedItem)
        editNode.Edit("/metadata/idinfo/status/update", cboxUpdate.SelectedItem)
    End Sub

    Private Sub frmTabBasicInfo_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Leave
        editXMLFile()
    End Sub

    Private Sub button_example_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_example.Click
        Dim helpForm As dialog_help = New dialog_help("BasicInfo")
        helpForm.ShowDialog()
    End Sub
End Class